package com.itheima.consumer.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class SpringLitenerWorkMQ {


    @RabbitListener(queues = "work.queue")
    public void listenerWork2Queue1(String msg) throws InterruptedException {
        System.out.println("消费者1 接受了消息:" + msg);
        Thread.sleep(20);
    }

    @RabbitListener(queues = "work.queue")
    public void listenerWork2Queue2(String msg) throws InterruptedException {

        System.err.println("消费者2 接受了消息......:" + msg);
        Thread.sleep(200);
    }

}
